var maxParallelImport = 2;
var parallelImport = 1;    	
Dropzone.options.acmeDropzoneForm = {
  init: function() {
    this.on("removedfile", function(file) {
    	var id = file.id;
    	var url = $("input[name='delete-picture']").val();
    	$.ajax({
			type: "POST",
			url: url,
			data: { id: id }
		});
    });
    
    this.on("success", function(file, responseText) {
    	var response = jQuery.parseJSON( responseText );
    	var i = 1;
    	$.each(response, function( index, value ) {
    		if(parallelImport == i){
    			file.id = index;
    		}
    		i++;
    	});
    	if(parallelImport % maxParallelImport == 0){
    		parallelImport = 0;
    	}
    	parallelImport++;
    });
    
//    this.on("successmultiple", function(file, responseText) {
//    	var response = jQuery.parseJSON( responseText );
//    	console.log(file.name);
//    	console.log(response);
//    	//file.id = response.id
//    	//console.log(response.id);
//    });     
  }
};